package com.bincloud.vue.admin.common.exception;

import lombok.Getter;

/**
 * @Description: 异常代码枚举
 * @Author: bincloud, mvpzhou
 * @Date: Create By bincloud, mvpzhou on 2022/2/16
 */
@Getter
public enum CodeMsg {
    /**
     * 异常代码枚举
     */
    OK("200", "成功"),
    VALIDATE_ERROR("400", "入参异常"),
    UNAUTHORIZED("401", "未授权访问"),
    FORBIDDEN("403", "禁止访问"),
    NOT_FOUND("404", "未找到"),
    FAIL("500", "未知异常"),
    /**
     * 用户认证相关
     * 500xx
     */
    ACCOUNT_EXPIRED("50001", "用户已过期"),
    ACCOUNT_LOCKED("50002", "用户已锁定"),
    CREDENTIALS_EXPIRED("50003", "密码已过期"),
    ACCOUNT_DISABLED("50004", "用户不可用"),
    ACCOUNT_NOT_EXIST("50005", "用户不存在"),
    ACCOUNT_PASSWORD_NOT_EXIST("50006", "密码不存在"),
    ACCOUNT_PASSWORD_VALIDATE_ERROR("50007", "密码验证失败"),
    /**
     * 用户管理相关
     * 501xx
     */
    UMS_USER_EXISTED("50101", "用户已存在"),
    UMS_USER_NOT_EXIST("50102", "用户不存在"),
    UMS_USER_ACCOUNT_ERROR("50103", "账号限制规则"),
    UMS_USER_PASSWORD_ERROR("50104", "密码限制规则"),
    UMS_USER_GENDER_ERROR("50105", "性别限制规则"),
    UMS_USER_NICKNAME_ERROR("50106", "昵称限制规则"),
    UMS_USER_EMAIL_ERROR("50107", "邮件限制规则"),
    UMS_USER_STATE_ERROR("50108", "状态限制规则"),
    UMS_USER_AVATAR_ERROR("50109", "头像限制规则"),
    UMS_USER_ACCOUNT_EXPIRE("50110", "账号有效期限制规则"),
    UMS_USER_CREDENTIALS_EXPIRE("50111", "密码有效期限制规则"),
    UMS_USER_UNAVAILABLE("50102", "用户不可用"),
    /**
     * 缓存相关
     * 502xx
     */
    REDIS_SET_FAIL("50201", "缓存设置失败"),
    REDIS_GET_FAIL("50202", "缓存获取失败"),
    REDIS_DELETE_FAIL("50203", "缓存删除失败"),
    /**
     * 验证码相关
     * 503xx
     */
    CAPTCHA_GENERATE_FAIL("50301", "验证码生成失败"),
    CAPTCHA_EXPIRED("50302", "验证码过期"),
    CAPTCHA_ERROR("50303", "验证码错误"),
    CAPTCHA_TWO_FACTOR_EXPIRED("50304", "双因子验证码过期"),
    CAPTCHA_TWO_FACTOR_ERROR("50305", "双因子验证码错误"),
    /**
     * 加解密相关
     * 504xx
     */
    ENCRYPT_FAIL("50401", "加密失败"),
    DECRYPT_FAIL("50402", "解密失败"),
    /**
     * 角色管理相关
     * 504xx
     */
    UMS_ROLE_EXISTED("50401", "角色已存在"),
    UMS_ROLE_NOT_EXIST("50402", "角色不存在"),
    UMS_ROLE_RELATION_NOT_EXIST("50403", "用户角色关系不存在"),
    UMS_ROLE_RELATION_EXISTED("50404", "用户角色关系已存在"),
    UMS_ROLE_STATE_ERROR("50505", "角色状态限制规则"),
    /**
     * 资源管理相关
     * 505xx
     */
    UMS_RESOURCE_EXISTED("50501", "资源已存在"),
    UMS_RESOURCE_NOT_EXIST("50502", "资源不存在"),
    UMS_RESOURCE_RELATION_NOT_EXIST("50503", "角色资源关系不存在"),
    UMS_RESOURCE_RELATION_EXISTED("50504", "角色资源关系已存在"),
    UMS_RESOURCE_STATE_ERROR("50505", "资源状态限制规则"),
    UMS_RESOURCE_TYPE_ERROR("50506", "资源类型限制规则"),
    /**
     * 菜单管理相关
     * 506xx
     */
    UMS_MENU_EXISTED("50601", "菜单已存在"),
    UMS_MENU_NOT_EXIST("50602", "菜单不存在"),
    UMS_MENU_STATE_ERROR("50603", "菜单状态限制规则"),
    UMS_MENU_RELATION_NOT_EXIST("50604", "用户菜单关系不存在"),
    UMS_MENU_RELATION_EXISTED("50605", "用户菜单关系已存在"),

    ;

    CodeMsg(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final String code;
    private final String msg;

}
